﻿using System.Diagnostics;

namespace getmaxprimenum
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            int i;
            for (i = 100000; i >= 1; i--)
            {
                int m;
                for (m = 2; m <i; m++)
                {
                    int remain = i % m;
                    if (remain == 0) break;
                }
                if (m == i) break;
            }
            Console.WriteLine($"100000以内最大的质数是{i}");
            sw.Stop();
            TimeSpan ts2 = sw.Elapsed;
            Console.WriteLine("本程序总共花费{0}ms.", ts2.TotalMilliseconds);
        }
    }
}